﻿#region 版权信息
// ------------------------------------------------------------------------------
// Copyright: (c) 2029  耍嗨科技（成都）有限公司 - Amm
// 项目名称：$SOLUTION/$.Amm.Services
// 文件名称：UserOutputDto.cs
// 创建时间：2020093020:36
// 更改时间：2020093020:36
//  ------------------------------------------------------------------------------
#endregion

using Colorful.Furniture.CommonDto;
using Colorful.Furniture.Extensions;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Xml.Linq;

namespace Colorful.Furniture.PermissionManagement
{
    /// <summary>
    ///  管理员基础输出类1
    /// </summary>
    public class ManagerBaseOutput1
    {
        /// <summary>
        ///  用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        ///  是否超级帐号
        /// </summary>
        public bool IsSupper { get; set; }

        /// <summary>
        ///  编码
        /// </summary>

        public Guid Id { get; set; }

        /// <summary>
        ///  部门编码
        /// </summary>
        public Guid? DepartmentId { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        public int? Age { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        public string Avatar { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 账户状态（0：禁用；1：正常）
        /// </summary>
        public bool IsDisabled { get; set; }

        /// <summary>
        /// 管理员类型(1：总部；2：分公司；3：供应商；4：直营门店；5：加盟门店)
        /// </summary>
        public NatureType? ManagerType { get; set; }

        /// <summary>
        /// 管理员姓名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///  电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        ///  职位
        /// </summary>
        public string Position { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public string Sex { get; set; }

        /// <summary>
        /// 创建时间
        /// </summary>

        public string AddTime { get; set; }

        /// <summary>
        /// 生日
        /// </summary>

        public DateTime? Birthday { get; set; }

        public string BirthDayFormat => Birthday.ToNullableDateString("yyyy-MM-dd");

        /// <summary>
        ///  用户编码
        /// </summary>

        public Guid? UserId { get; set; }

        /// <summary>
        /// 部门名字
        /// </summary>
        public string DepartmentName { get; set; }

        /// <summary>
        /// 客户编码
        /// </summary>
        public Guid? CustomerId { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerName { get; set; }

        /// <summary>
        ///  微信公众号绑定二维码
        /// </summary>
        public string WechatQrCode { get; set; }
    }

    /// <summary>
    ///  性质类型
    /// </summary>
    public enum NatureType
    {
        /// <summary>
        /// 总部
        /// </summary>
        总部 = 1,
        /// <summary>
        /// 分公司
        /// </summary>
        分公司 = 2
    }

    /// <summary>
    ///  管理员输出信息
    /// </summary>
    public class ManagerOutputDto : ManagerBaseOutput1
    {
        /// <summary>
        /// 角色-角色名字（多个角色名字用,符号分割）
        /// </summary>
        [JsonIgnore]
        public string RoleName { get; set; }

        /// <summary>
        ///  部门编码列表
        /// </summary>
        public List<Guid> DepartmentIdList { get; set; }

        /// <summary>
        ///  角色-角色编码（多个角色名字用,符号分割）
        /// </summary>
        [JsonIgnore]
        public string RoleId { get; set; }

        /// <summary>
        ///  管理员角色编码
        /// </summary>
        public List<Guid?> RoleIdList => RoleId.StringToGeneric<List<Guid?>>();

        /// <summary>
        ///  管理员角色名字
        /// </summary>
        public List<string> RoleNameList => RoleName.StringToGeneric<List<string>>();
    }

    /// <summary>
    ///  管理员登录信息
    /// </summary>
    public class ManagerLoginOutputDto
    {
        /// <summary>
        ///  用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        /// 管理员类型
        /// </summary>
        public NatureType? ManagerType { get; set; }

        /// <summary>
        ///  姓名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///  是否超级帐号
        /// </summary>
        public bool IsSupper { get; set; }

        /// <summary>
        ///  编码
        /// </summary>

        public Guid Id { get; set; }

        /// <summary>
        ///  所属机构编码
        /// </summary>
        public Guid DepartmentId { get; set; }

        /// <summary>
        ///  机构名字
        /// </summary>
        public string DepartmentName { get; set; }

        /// <summary>
        ///  机构代码
        /// </summary>
        public string DepartmentCode { get; set; }

        /// <summary>
        ///  机构层级代码
        /// </summary>
        public string DepartmentClassId { get; set; }

        /// <summary>
        ///  电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        ///  职位
        /// </summary>
        public string Position { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public string Sex { get; set; }

        /// <summary>
        /// 身份证号码
        /// </summary>
        public string IdCard { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        public int? Age { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        public string Avatar { get; set; }

        /// <summary>
        /// 客户编码
        /// </summary>
        public Guid? CustomerId { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerName { get; set; }

    }

    /// <summary>
    ///  管理员信息带菜单和权限的输出
    /// </summary>
    public class ManagerInfoOutputDto : ManagerLoginOutputDto, IDefinePermissionDto
    {
        /// <summary>
        ///  菜单列表
        /// </summary>
        public List<PermissionMenuOutputDto> MenuList { get; set; }

        /// <summary>
        ///  角色编码集合
        /// </summary>
        public List<Guid?> RoleList { get; set; }

        /// <summary>
        ///  权限列表
        /// </summary>
        public List<PermissionOutputDto> PermissionList { get; set; }
    }

    /// <summary>
    ///  管理员分页列表输出
    /// </summary>
    public class ManagerPageOutputDto : IDefinePermissionDto
    {
        /// <summary>
        ///  编码
        /// </summary>
        public Guid Id { get; set; }

        /// <summary>
        ///  用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        ///  所属机构编码
        /// </summary>
        public Guid? DepartmentId { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        public int? Age { get; set; }

        /// <summary>
        /// 头像
        /// </summary>
        public string Avatar { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 账户状态（0：禁用（离职）；1：正常（在职））
        /// </summary>
        public bool IsDisabled { get; set; }

        /// <summary>
        /// 管理员类型(1：总部；2：分公司；3：供应商；4：直营门店；5：加盟门店)
        /// </summary>
        public int? ManagerType { get; set; }

        /// <summary>
        /// 管理员姓名
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        ///  角色名字
        /// </summary>
        public string RoleName { get; set; }

        /// <summary>
        ///  电话
        /// </summary>
        public string Phone { get; set; }

        /// <summary>
        ///  职位
        /// </summary>
        public string Position { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public string Sex { get; set; }

        /// <summary>
        /// 开通时间
        /// </summary>

        public string AddTime { get; set; }

        /// <summary>
        ///  是否超级管理员帐号
        /// </summary>
        public bool IsSupper { get; set; }

        /// <summary>
        /// 生日
        /// </summary>

        public string Birthday { get; set; }

        /// <summary>
        /// 所属机构名称
        /// </summary>
        public string DepartmentName { get; set; }

        /// <summary>
        /// 客户编码
        /// </summary>
        public Guid? CustomerId { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerName { get; set; }


    }

    /// <summary>
    ///  普通管理员输出请求体
    /// </summary>
    public class ManagerNormalOutputDto : ManagerOutputDto
    {
        /// <summary>
        ///  管理员授权列表
        /// </summary>
        public List<SysManagerIdentityOutputDto> ManagerIdentityList { get; set; }
    }

    /// <summary>
    ///  管理员角色输出信息
    /// </summary>
    public class ManagerRoleOutputDto
    {

        /// <summary>
        /// 编码
        /// </summary>

        public Guid Id { get; set; }

        /// <summary>
        /// 管理员编码
        /// </summary>

        public Guid? ManagerId { get; set; }

        /// <summary>
        /// 角色编码
        /// </summary>

        public Guid? RoleId { get; set; }
    }

    /// <summary>
    ///  管理员授权表输出信息
    /// </summary>
    public class SysManagerIdentityOutputDto
    {

        /// <summary>
        /// 编码
        /// </summary>

        public Guid Id { get; set; }

        /// <summary>
        /// 管理员编码编码
        /// </summary>

        public Guid? ManagerId { get; set; }

        /// <summary>
        /// 例如 密码,存OpenId、Id，同一IdentityType的OpenId的值是唯一的
        /// </summary>

        public string Credential { get; set; }

        /// <summary>
        /// 认证者，例如 用户名（PassWord认证类型）,授权得到的昵称(QQ),授权得到的用户名（唯一，GitHub)
        /// </summary>

        public string Identifier { get; set; }

        /// <summary>
        /// 认证类型，如 Password，GitHub、QQ、WeiXin、PhoneNumber等
        /// </summary>

        public string IdentityType { get; set; }
    }

    /// <summary>
    ///  员工列表请求体
    /// </summary>
    public class ManagerPagedInputDto : PageInputDto
    {
        /// <summary>
        /// 关键词
        /// </summary>
        public string Keywords { get; set; }

        /// <summary>
        ///  身份证号码
        /// </summary>
        public string IdCard { get; set; }

        /// <summary>
        ///  性别
        /// </summary>
        public string Sex { get; set; }

        /// <summary>
        ///  人员状态（0：离职；1：在职）
        /// </summary>
        public string Status { get; set; }

        /// <summary>
        ///  账户状态（0：禁用；1：正常）
        /// </summary>
        public bool? IsDisabled { get; set; }

        /// <summary>
        ///  所属机构
        /// </summary>
        public Guid? OrganizationId { get; set; }

        /// <summary>
        /// 职位
        /// </summary>
        public string Position { get; set; }


        /// <summary>
        /// 角色-角色名字（多个角色名字用,符号分割）
        /// </summary>
        public string RoleName { get; set; }

        /// <summary>
        /// 客户编码
        /// </summary>
        public Guid? CustomerId { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerName { get; set; }

    }

    /// <summary>
    /// 管理员状态输入体
    /// </summary>
    public class ManagerStatesInputDto
    {
        /// <summary>
        /// 管理员id
        /// </summary>
        public List<Guid?> Id { get; set; }

        /// <summary>
        ///  管理员账户状态（禁用和启用）
        /// </summary>

        public int StateType { get; set; }
    }

    /// <summary>
    ///  管理员保存请求体
    /// </summary>
    public class ManagerSaveInputDto
    {
        /// <summary>
        ///  用户名
        /// </summary>
        public string UserName { get; set; }

        /// <summary>
        ///  编码
        /// </summary>
        public Guid? Id { get; set; }

        /// <summary>
        ///  部门编码集合
        /// </summary>
        public List<Guid> DepartmentIdList { get; set; }

        /// <summary>
        /// 年龄
        /// </summary>
        public int? Age { get; set; }

        /// <summary>
        /// 邮箱
        /// </summary>
        public string Email { get; set; }

        /// <summary>
        /// 账户状态（0：禁用；1：正常）
        /// </summary>
        public bool IsDisabled { get; set; }

        /// <summary>
        /// 管理员姓名
        /// </summary>
        [Required(ErrorMessage = "请输入姓名")]
        public string Name { get; set; }

        /// <summary>
        ///  电话
        /// </summary>
        [Required(ErrorMessage = "请输入联系电话")]
        public string Phone { get; set; }

        /// <summary>
        ///  职位
        /// </summary>
        public string Position { get; set; }

        /// <summary>
        /// 性别
        /// </summary>
        public string Sex { get; set; }

        /// <summary>
        /// 生日
        /// </summary>

        public string Birthday { get; set; }

        /// <summary>
        /// 客户编码
        /// </summary>
        public Guid? CustomerId { get; set; }

        /// <summary>
        /// 客户名称
        /// </summary>
        public string CustomerName { get; set; }

        /// <summary>
        ///  员工角色
        /// </summary>
        public List<RoleIdListInputDto> ManagerRoleList { get; set; }
    }

    /// <summary>
    ///  管理员角色ID请求体
    /// </summary>
    public class RoleIdListInputDto
    {
        /// <summary>
        /// 角色编码
        /// </summary>

        public Guid? RoleId { get; set; }

        /// <summary>
        ///  角色名字
        /// </summary>
        public string RoleName { get; set; }
    }


    /// <summary>
    ///  管理员授权表请求体
    /// </summary>
    public class SysManagerIdentitySaveInputDto
    {
        /// <summary>
        /// 编码
        /// </summary>

        public Guid Id { get; set; }

        /// <summary>
        /// 管理员编码编码
        /// </summary>

        public Guid? ManagerId { get; set; }

        /// <summary>
        /// 例如 密码,存OpenId、Id，同一IdentityType的OpenId的值是唯一的
        /// </summary>

        public string Credential { get; set; }

        /// <summary>
        /// 认证者，例如 用户名（PassWord认证类型）,授权得到的昵称(QQ),授权得到的用户名（唯一，GitHub)
        /// </summary>

        public string Identifier { get; set; }

        /// <summary>
        /// 认证类型，如 Password，GitHub、QQ、WeiXin、PhoneNumber等
        /// </summary>

        public string IdentityType { get; set; }
    }

    /// <summary>
    ///  管理员重置密码请求体
    /// </summary>
    public class ManagerPasswordSaveInputDto
    {

        /// <summary>
        /// 例如 密码,存OpenId、Id，同一IdentityType的OpenId的值是唯一的
        /// </summary>
        [Required(ErrorMessage = "请输入密码")]
        [MinLength(8, ErrorMessage = "密码长度限定为8-36个字符")]
        [MaxLength(36, ErrorMessage = "密码长度限定为8-36个字符")]
        public string Password { get; set; }
    }

    /// <summary>
    ///  管理员选项输出
    /// </summary>
    public class ManagerOptionOutputDto : OptionOutputIdDto
    {
        /// <summary>
        /// 部门编码
        /// </summary>
        public Guid? DepartmentId { get; set; }

        /// <summary>
        ///  部门名字
        /// </summary>
        public string DepartmentName { get; set; }
    }


    /// <summary>
    ///  人员部门输出体
    /// </summary>
    public class ManagerDepartmentOutputDto
    {
        /// <summary>
        ///  部门编码
        /// </summary>
        public Guid? DepartmentId { get; set; }

        /// <summary>
        ///  部门名字
        /// </summary>
        public string DepartmentName { get; set; }
    }
}